package com.example.peng.myokhttpfinal;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.example.peng.mycallback.BaseRequestCallBack;

import cn.finalteam.okhttpfinal.HttpRequest;
import cn.finalteam.okhttpfinal.RequestParams;

public class MainActivity extends AppCompatActivity implements MyHttpCycleContext {

    protected final String HTTP_TASK_KEY = "HttpTaskKey_" + hashCode();
    private String strUrl1 = "https://app.xbx121.com/Api_v5/Information/class_config.json";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getStringJsonTest();
    }

    private void getStringJsonTest() {
        RequestParams params = new RequestParams(this);
        HttpRequest.post(strUrl1, params, new BaseRequestCallBack<String>() {
            @Override
            protected void onSuccess(String s) {
                super.onSuccess(s);
            }
        });
    }

    @Override
    public Context getContext() {
        return this;
    }

    @Override
    public String getHttpTaskKey() {
        return HTTP_TASK_KEY;
    }
}
